home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
5
/
CHASSIS_
/
WRITEFRO.C
< prev
Wrap
Text File
|
1992-05-14
|
1KB
|
34 lines
/************************************************************************************/
/* WriteFromTE */
/* */
/* Writes to open file from existing TextEdit record */
/************************************************************************************/
#include "MyHeaders.h"
long WriteFromTE(int pathRefNum, TEHandle hTE)
{
OSErr writeErr; /* return from I/O routines */
long bytesWrite = 0; /* total of bytes returned */
Ptr beginP; /* ptr to begin of temp I/O area */
CursorSelect (NIL, NIL, watchCursor); /* set watch cursor */
writeErr = SetFPos (pathRefNum, fsFromStart, 0); /* positn file ptr to begin */
bytesWrite = (**hTE).teLength; /* number of bytes to write */
beginP = *(**hTE).hText; /* pointer to text */
writeErr = FSWrite (pathRefNum, &bytesWrite, beginP); /* write to the file */
if (writeErr == noErr)
SetEOF (pathRefNum, bytesWrite); /* set new EOF */
else
{
ParamText (&workReply.fName,"","",""); /* set text as file name */
PlaceAlert (140); /* position the alert */
StopAlert (140, NIL); /* show the alert */
}
return bytesWrite; /* return total no of bytes */
}